{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Notebook for preparing and saving MOLECULAR graphs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import torch\n",
    "import pickle\n",
    "import time\n",
    "import os\n",
    "%matplotlib inline\n",
    "import matplotlib.pyplot as plt\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Download ZINC dataset"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "downloading..\n",
      "  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n",
      "                                 Dload  Upload   Total   Spent    Left  Speed\n",
      "  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0\n",
      "  0     0    0     0    0     0      0      0 --:--:--  0:00:01 --:--:--     0\n",
      "100  366M  100  366M    0     0  1805k      0  0:03:27  0:03:27 --:--:-- 2863k:36  0:00:42  0:02:54  850k00:52  0:03:03  717k      0  0:03:55  0:01:26  0:02:29 1089k     0  0:04:04  0:01:56  0:02:08 2071k32k 0  0:03:45  0:03:00  0:00:45  534kk   0     0  1790k      0  0:03:29  0:03:25  0:00:04 2757k\n",
      "x molecules/atom_dict.pickle\n",
      "x molecules/bond_dict.pickle\n",
      "x molecules/test.pickle\n",
      "x molecules/train.pickle\n",
      "x molecules/val.pickle\n"
     ]
    }
   ],
   "source": [
    "if not os.path.isfile('molecules.zip'):\n",
    "    print('downloading..')\n",
    "    !curl https://www.dropbox.com/s/feo9qle74kg48gy/molecules.zip?dl=1 -o molecules.zip -J -L -k\n",
    "    !tar -xvf molecules.zip -C ../\n",
    "else:\n",
    "    print('File already downloaded')\n",
    "    "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Convert to DGL format and save with pickle"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "/Users/xbresson/Documents/Dropbox/06_NTU_2017_now/03_my_codes/34_benchmark20/GITHUB_benchmark_project/benchmarking-gnn\n"
     ]
    }
   ],
   "source": [
    "import os\n",
    "os.chdir('../../') # go to root folder of the project\n",
    "print(os.getcwd())\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "import pickle\n",
    "\n",
    "%load_ext autoreload\n",
    "%autoreload 2\n",
    "\n",
    "from data.molecules import MoleculeDatasetDGL \n",
    "\n",
    "from data.data import LoadData\n",
    "from torch.utils.data import DataLoader\n",
    "from data.molecules import MoleculeDataset\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "preparing 10000 graphs for the TRAIN set...\n",
      "preparing 1000 graphs for the VAL set...\n",
      "preparing 1000 graphs for the TEST set...\n",
      "Time taken: 90.7071s\n"
     ]
    }
   ],
   "source": [
    "DATASET_NAME = 'ZINC'\n",
    "dataset = MoleculeDatasetDGL(DATASET_NAME) \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX0AAAEICAYAAACzliQjAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAAT30lEQVR4nO3df5Bd5X3f8fensk39A2xsFhdLOMIe2RNgHLloCJ3ULh07gUIa4aRORVobp7QCD8zYE3caSNsx9VSt6pp46kmMI4IGyNhQJcRBGZsm2E1NM8XGC1FAgKmFkWGRKm1MHKD2qJb49o89W27F3ZX23qtd3X3er5k7e+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GutjNle/lskxm0jyum76lcB7gW8x/sesb7/G6Zi1evfObcD5zLwOdR/wceAPgG3Am4EngfdX1VhdFJ2jX+cz80/OAnYDV8yOqY6LJH8b+O/AQ8ALXfnXmBn/HttjNk+/LmX8j9k7mLlQu4KZk8ttVfWJJG9gvI/ZXP36HcbkmDUZ+pLUKod3JKkhhr4kNcTQl6SGGPqS1BBDX5IaYuhLUkMMfUlqyP8FzYZRiEH4Db4AAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "min/max : 9 37\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAEICAYAAACktLTqAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAASdklEQVR4nO3df6xkZX3H8ffHFbFVDCAXsgLrIkETNHZpbrGNP7oVq4BGxFTK2tjVmi4mkmrsH6yYVGpCglY0NlrNGqjY8MNVpJJAW9Co1EbUXURcXKkLrrqw3b26WiFaml2+/WPOpuNl7t4fM8Pd+9z3K5nMmeecM+f75GE/9/DMOTOpKiRJbXnSYhcgSRo9w12SGmS4S1KDDHdJapDhLkkNMtwlqUGGuzRNkrVJdi12HdIwDHdpDJKsTlJJnrzYtWh5MtwlqUGGu5qVZGOSz01r+0iSv0/yliTbkzyc5IEkFx3ifS5J8mC37X1Jzuran9Qd4/4kP0uyOcmx3W53dM+/SPJIkj8YTy+lwQx3tex64NwkzwBIsgK4ALgO2Au8BngG8Bbgw0l+d/obJHkecDHwe1V1FPAqYGe3+q+A1wF/CDwL+DnwsW7dy7rno6vq6VX19ZH3TjoEw13NqqofAXfRC2CAlwO/qqo7q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/29tvySrgTOAb9D4uE7rKzQ2rklWJLkb2AvcXlXNjukMfYVFHtMWwn05+ThwKrAG2A1cubjljE6SpwM3Au+sql8udj3jNKCvzY1rVR2oqjX07k4/M8kLFrumcZmhr4s+pi2E+55uLvPgnObeRa5nbKpqT/cf0mPAJ+l9++aS181V3ghcW1Wf75qbHNdBfW11XAGq6hfAV+jNQTc5pgf19/VwGNMWwv1mYH23vB74wiLWMlYH/2F0zge2zbTtUtF9IHUVsL2qPtS3qrlxnamvrY1rkokkR3fLvwW8Avg+bY7pwL4eDmO61K6WuR5YS+8rNfcA7wX+GdgMrAJ+DLyhqpb8B5Ez9HUtvf/NK2AncNHBOcylKslLgH8Hvgs81jVfSm8uuqlxPURf19HQuCZ5Ib0PTFfQO4HcXFXvS/JM2hvTmfr6TyzymC6pcJckzU0L0zKSpGkMd0lqkOEuSQ0y3CWpQYa7JDXIcJekBhnuktSg/wOuosMelekeBwAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "min/max : 10 36\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAEICAYAAACktLTqAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjAsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+17YcXAAARgElEQVR4nO3de4zlZX3H8fenq3hBLSgD2XJxwaAWjV2bKWq8lBatCCpqA7JRC9W6kkqi0baCbeqlIaVWNE1asUshoFWQFC80UJVSKxrrZcAVF4EKuOrCdncUKFANleXbP+a36XE9w+yc3znMzjPvV3Iyv/P8Luf78LCfffY5v3MmVYUkqS2/tNQFSJLGz3CXpAYZ7pLUIMNdkhpkuEtSgwx3SWqQ4S5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3VtXdS13PJA3pa3PjWlU7qmotc582PzLJ05e6pkmZp6/Lbkz31HDf1q1n7lzX3L7E9UxEVW3r/kd6ADiXuW/TXPa6tcpLgY9V1Se75ibHdFhfWx1XgKq6C/h35tagmxzTnQb7uhzHdE8N98uAk7vtk4HPLGEtE7PzD0bnlcCm+Y5dLro3pM4DbqiqDwzsam5M5+tra+OaZCrJPt32o4AXAjfS5pgO7etyHNM94W6Zi4CjmPtazW3Au4BPA5cAhwA/AE6oqmX9ZuQ8/TyKuX/mFbAZeNPONczlKsnzgC8B3wYe6JrfydxadGtjOl9f19HQuCZ5BnNvmK5ibkJ4SVW9N8kTaG9M5+vrR1lmY7rk4S5JGr89dVlGktSD4S5JDTLcJalBhrskNchwl6QGGe6S1CDDXZIa9H+nSoFf5nOUxQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "min/max : 11 37\n"
     ]
    }
   ],
   "source": [
    "def plot_histo_graphs(dataset, title):\n",
    "    # histogram of graph sizes\n",
    "    graph_sizes = []\n",
    "    for graph in dataset:\n",
    "        graph_sizes.append(graph[0].number_of_nodes())\n",
    "    plt.figure(1)\n",
    "    plt.hist(graph_sizes, bins=20)\n",
    "    plt.title(title)\n",
    "    plt.show()\n",
    "    graph_sizes = torch.Tensor(graph_sizes)\n",
    "    print('min/max :',graph_sizes.min().long().item(),graph_sizes.max().long().item())\n",
    "    \n",
    "plot_histo_graphs(dataset.train,'trainset')\n",
    "plot_histo_graphs(dataset.val,'valset')\n",
    "plot_histo_graphs(dataset.test,'testset')\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "10000\n",
      "1000\n",
      "1000\n",
      "(DGLGraph(num_nodes=29, num_edges=64,\n",
      "         ndata_schemes={'feat': Scheme(shape=(), dtype=torch.int64)}\n",
      "         edata_schemes={'feat': Scheme(shape=(), dtype=torch.int64)}), tensor([0.8350]))\n",
      "(DGLGraph(num_nodes=35, num_edges=78,\n",
      "         ndata_schemes={'feat': Scheme(shape=(), dtype=torch.int64)}\n",
      "         edata_schemes={'feat': Scheme(shape=(), dtype=torch.int64)}), tensor([0.6299]))\n",
      "(DGLGraph(num_nodes=16, num_edges=34,\n",
      "         ndata_schemes={'feat': Scheme(shape=(), dtype=torch.int64)}\n",
      "         edata_schemes={'feat': Scheme(shape=(), dtype=torch.int64)}), tensor([1.9973]))\n"
     ]
    }
   ],
   "source": [
    "print(len(dataset.train))\n",
    "print(len(dataset.val))\n",
    "print(len(dataset.test))\n",
    "\n",
    "print(dataset.train[0])\n",
    "print(dataset.val[0])\n",
    "print(dataset.test[0])\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "num_atom_type = 28\n",
    "num_bond_type = 4\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Time (sec): 6.659376859664917\n"
     ]
    }
   ],
   "source": [
    "start = time.time()\n",
    "with open('data/molecules/ZINC.pkl','wb') as f:\n",
    "        pickle.dump([dataset.train,dataset.val,dataset.test,num_atom_type,num_bond_type],f)\n",
    "print('Time (sec):',time.time() - start)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Test load function"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[I] Loading dataset ZINC...\n",
      "train, test, val sizes : 10000 1000 1000\n",
      "[I] Finished loading.\n",
      "[I] Data load time: 8.5329s\n"
     ]
    }
   ],
   "source": [
    "DATASET_NAME = 'ZINC'\n",
    "dataset = LoadData(DATASET_NAME)\n",
    "trainset, valset, testset = dataset.train, dataset.val, dataset.test\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'data.molecules.MoleculeDataset'>\n"
     ]
    }
   ],
   "source": [
    "batch_size = 10\n",
    "collate = MoleculeDataset.collate\n",
    "print(MoleculeDataset)\n",
    "train_loader = DataLoader(trainset, batch_size=batch_size, shuffle=True, collate_fn=collate)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
